package io.github.bigbird0101.datatransfer.container;

import integration.data.task.writer.*;
import integration.data.task.writer.es.ElasticSearchWriter;
import integration.modle.exception.IntegrationValidException;

import static io.github.bigbird0101.datatransfer.constants.Constant.*;

public class WriterProcessor {


    public static Writer getWriterName(String writerName) {
        switch (writerName) {
            case WRITER_PLUGIN_MYSQL:
                return new MysqlWriter();
            case WRITER_PLUGIN_ORACLE:
                return new OracleWriter();
            case WRITER_PLUGIN_POSTGRESQL:
                return new PostgresqlWriter();
            case WRITER_PLUGIN_SQLSERVER:
                return new SqlServerWriter();
            case WRITER_PLUGIN_KINGBASEES:
                return new KingbaseWriter();
            case WRITER_PLUGIN_MONGODB:
                return new MongoDBWriter();
            case WRITER_PLUGIN_KAFKA:
                return new KafkaWriter();
            case WRITER_PLUGIN_ELASTICSEARC:
                return new ElasticSearchWriter();
            case WRITER_PLUGIN_CASSANDRA:
                return new CassandraWriter();
            case WRITER_PLUGIN_RDBMS:
                return new RdbmsWriter();
            case WRITER_PLUGIN_STREAM:
                return new StreamWriter();
            default:
                throw new IntegrationValidException(String.format("不支持写入类型: %s", writerName));
        }
    }


}
